<?php
/**
 * 系统全局配置
 */
namespace Api;
use Kuyuan\WqCore\api\Api;
use Kuyuan\WqCore\plug\defend\Defend;
use Kuyuan\WqCore\util\Util;

class System extends Api
{
    private $System = null;
    public function __construct()
    {
        parent::__construct();
        $this->System = new \Controller\System();
    }

    /**
     * 获取参数
     */
    public function find()
    {
        Util::appointGet();
        $_system = $this->System->find();
        Util::returns(array("code"=>0,"data"=>$_system));
    }

    /**
     * 设置参数
     */
    public function set()
    {
        Util::appointPost();
        if($this->System->set($this->_gpc["data"])){
            $_result = array("code"=>0);
        } else {
            $_result = array("code"=>103);
        }
        Util::returns($_result);
    }

    /**
     * 检测是否安装了酷源防封
     */
    public function testKuyuanDefend()
    {
        Util::appointGet();
        $Defend = new Defend();
        Util::returns(array("code"=>0,"data"=>$Defend->test() ? 1 : 0));
    }
}